Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: added charm config #117

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

wip: added charm config #117

wants to merge 29 commits into from

Conversation

samhotep
Copy link
Member

Done

  • Added charm config for building a cs.canonical.com charm. This config should not affect current deployments, but allow deploying as both a plain kubernetes resource or as a charm.

QA

QA steps

  • Steps for QA.

Fixes

Screenshots

It could be helpful to provide some screenshots to aid in QAing the change.

@webteam-app
Copy link

.env Outdated
@@ -17,3 +17,4 @@ GOOGLE_DRIVE_FOLDER_ID=googlecreds
COPYDOC_TEMPLATE_ID=googlecreds
GOOGLE_PRIVATE_KEY=base64encodedprivatekey
GOOGLE_PRIVATE_KEY_ID=privatekeyid
FLASK_DEBUG=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is better be set in .env.local?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch

@@ -0,0 +1,9 @@
venv/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be .venv?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's created by default by the charm initialization, along with some charm src files, so I've left it as is

@@ -38,7 +49,7 @@ def create_app():
init_cache(app)

# Initialize tasks
init_tasks(app)
# init_tasks(app)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is not needed, can it be removed? Also, could you please explain how the tasks are going to be launched now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll remove it.
We're now using celery which will coordinate the background tasks between instances. I'm adding a section to the README


self.logger.info(f"Loading {self.repository_uri} from database")
self.invalidate_cache()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain this change please?

Copy link
Member Author

@samhotep samhotep Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its just a stylistic change because the else: branch was redundant and I prefer putting the log first before any other process starts

# Create the locks for the site trees
LOCKS = {}
# Default delay between runs for scheduled tasks
TASK_DELAY = int(os.getenv("TASK_DELAY", 5))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rebase against main, as I added another task that has a different periodicity.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Lemme do that and include the changes as we're now using celery for the periodic tasks.
I'll also update the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants